<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<input id="a" type="text">
<p></p>
</body>


<script>

    let aa = {};
    Object.defineProperty(aa, "text", {
        get() {
            return aa1;
        },
        set(newValue) {
            console.log(newValue),
                aa1 = newValue
            document.getElementsByTagName("p")[0].innerHTML = aa1
        }
    });
    aa.text = "dfd"

    let elementsByTagName = document.getElementsByTagName("input");
    elementsByTagName[0].addEventListener("input", ()=>{
        // console.log(elementsByTagName[0].value)
        aa.text = elementsByTagName[0].value
        // console.log(aa.text)
    })
</script>
</html>